[index]

If Control Statement

Syntax

if <condition> then
<commands> [else if <condition> then <commands>] [else <commands>] end if

Description

Examples

You can use the if control statement to facilitate an invoicing system in which customers with purchases of less then $10,000 receive a 5% discount, and customers with purchases more than $10,000 receive a 10% discount. 2. Enter a dollar amount into the field. 3. If...then statements cannot be issued from the Message Box, so create a button with the following script: on mouseUp put field "sales" into sales if sales > 10000 then put 10 into discount else put 5 into discount end if type discount end mouseUp The If...then construction in the previous example is relatively simple, because only one command is used after then and else. It is possible, however, to use several commands. Change your button's script to look like the following: on mouseUp put field "sales" into sales If sales > 10000 then put 10 into discount put sales/100*90 into total else put 5 into discount put sales/100*95 into total end if type discount & type total
This text has been mechanically extracted from the Oracle Media Objects 1.0.4.9 MediaTalk Reference, © 1995 Oracle Corporation, and is provided here solely for educational/historical purposes.